<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
	xmlns:a="http://richfaces.org/a4j"
    template="/layout/template.xhtml">

<ui:define name="body">
	<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"/>
	<script type="text/javascript" src="#{request.contextPath}/common/js/gMaps.js"/>

	<rich:panel>
		<f:facet name="header">Create an new travel!!</f:facet>   
		<h:panelGrid >
			<s:button view="/acab/travel/CreateTravelBegin.xhtml" value="new Travel" propagation="join" />
		</h:panelGrid>
	</rich:panel>


	<rich:panel>
		<f:facet name="header">These are my travels</f:facet>   
		<h:panelGrid >
		
			<h:outputText value="The travel search returned no results."
               rendered="#{empty myTravelsBean.resultList}"/>

		    <rich:dataTable id="myTravelsBean"
		                var="_travel"
		              value="#{myTravelsBean.resultList}"
		           rendered="#{not empty myTravelsBean.resultList}">

		        <h:column>
		            <f:facet name="header">
		                <ui:include src="/layout/sort.xhtml">
		                    <ui:param name="entityList" value="#{myTravelsBean}"/>
		                    <ui:param name="propertyLabel" value="Travel name"/>
		                    <ui:param name="propertyPath" value=""/>
		                </ui:include>
		            </f:facet>
		            <h:outputText value="#{_travel.name}"/>
		        </h:column>
		        
		        <h:column>
		            <f:facet name="header">From</f:facet>
		            #{'('}
		            <h:outputText value="#{_travel.fromLat}"/>
		            #{' , '}
		            <h:outputText value="#{_travel.fromLon}"/>
		            #{')'}
					
					<rich:gmap 	zoom="11" mapType="G_NORMAL_MAP"  enableInfoWindow="false" showGMapTypeControl="false" showGLargeMapControl="false" showGScaleControl="false"
								style="width: 100px; height: 100px;overflow-x: hidden; overflow-y: hidden; position: relative; background-color: rgb(229, 227, 223); " lat="#{_travel.fromLat}" lng="#{_travel.fromLon}">
					</rich:gmap>  

		        </h:column>

		        <h:column>
		            <f:facet name="header">To</f:facet>
		            #{'('}
		            <h:outputText value="#{_travel.toLat}"/>
		            #{' , '}
		            <h:outputText value="#{_travel.toLon}"/>
		            #{')'}
		            
		            <rich:gmap 	zoom="11" mapType="G_NORMAL_MAP"  enableInfoWindow="false" showGMapTypeControl="false" showGLargeMapControl="false" showGScaleControl="false"
								style="width: 100px; height: 100px;overflow-x: hidden; overflow-y: hidden; position: relative; background-color: rgb(229, 227, 223); " lat="#{_travel.toLat}" lng="#{_travel.toLon}">
					</rich:gmap> 
		        </h:column>
		        
		        <h:column>
		            <f:facet name="header">Distance</f:facet>
					<h:outputText value="#{_travel.distance}Km."/>
		        </h:column>
		        
		        <h:column>
		            <f:facet name="header">Date/Period</f:facet>
					<h:outputText>
						#{_travel.beginDate}
						#{_travel.singleDay? '' :  ' / '}
						#{_travel.singleDay? '' :  _travel.endDate}
					</h:outputText>
		        </h:column>
		        
		        <rich:column>
		        	<rich:dataTable id="seats"
		            	    var="_seat"
		              	  value="#{_travel.seats}"
		           	   rendered="#{not empty _travel.seats}">
		           
		           		<rich:column>
		           			<h:outputText value="#{_seat.seatNumber}">
		           			</h:outputText>
		           			<h:graphicImage height="30px" url="/img/icons/#{_seat.state.equals('FREE')?'seat_black.jpg':'seat_gold.jpg'}"/>
		           		</rich:column>
		           
		        	</rich:dataTable>
		        </rich:column>
		        
		        <h:column>
		            <f:facet name="header">Conversations</f:facet>
		            <s:link view="/acab/dialog/TravelDialogs.xhtml"
		             propagation="begin"
		                      id="viewDialogsId"
		                      rendered="#{not empty _travel.dialogs}">
		                <f:param name="idTravel" value="#{_travel.idTravel}"/>
		            	<s:graphicImage value="#{dialogManager.travelHasUnreadDialogs(_travel)? '/img/icons/conv_yellow.gif': '/img/icons/conv_black.gif'}" height="22"/>
		            </s:link>
		            <s:link rendered="#{empty _travel.dialogs}">
		            	<s:graphicImage value="/img/edit.gif" height="22"/>
		            </s:link>
		        </h:column>
		        
			</rich:dataTable>
		  
		</h:panelGrid>
	</rich:panel>		
        
        
</ui:define>
</ui:composition>
	